import request from '@/common/request.js'
import { formatGetUri } from '@/common/util.js'

const api = {}
/*
*
* @ api.register params
* url 请求路径
* method 请求方法 必须大写，为了兼容其他应用
* data  请求数据
* power 请求方式
*/
// POST请求方式
api.register = params => request.globalRequest(`/mobile/signUp`, 'POST', params, 1)
// GET请求方式

/*
*登录页面一系列接口
*/
api.register = params => request.globalRequest(`/mobile/signUp${formatGetUri(params)}`, 'GET',{}, 1)
//用户密码登录
api.autoLign = params => request.globaSignIn(`/app/auto/login`, 'POST', params)
//用户获取短信验证码
api.getMsgCode = params => request.globaSignIn(`/app/auto/registerCode/${params}`, 'GET',{})
//用户验证码登录
api.autoLignCode = params => request.globaSignIn(`/app/auto/codeLogin`, 'POST', params)
//微信第三方登录
api.autoLignWx = params => request.globaSignIn(`/app/wx/grant`, 'POST', params)
api.autoLignWxCode = params => request.globaSignIn(`/app/wx/grant/${params}`, 'GET', )
//用户注册
api.register = params => request.globaSignIn(`/app/auto/registerAgent`, 'POST', params)

/*
**全民经纪人首页一系列接口
*/
//获取总收入
api.getIncome =() => request.globalRequest(`/applet/home/income`, 'GET',{})
//获取产品数据
api.getProMode =() => request.globalRequest(`/applet/home/projectMode`, 'GET',{})
//获取主栏目数据
api.getIndexColunm =() => request.globalRequest(`/applet/home/mainColumn`, 'GET',{})
//首页订单数据
api.getIndexCensus =() => request.globalRequest(`/applet/home/census`, 'GET',{})

//产品详细介绍
api.getProductOne = params => request.globalRequest(`/applet/project/findOne/${params}`, 'GET',{})

/*
*全民经纪人 待审批界面
*/
//获取产品类型数据
api.getProjectList = () => request.globalRequest(`/applet/order/condition`, 'GET',{})
// 获取全部经纪人数据
api.getTeamTerm = () => request.globalRequest(`/applet/order/teamTerm`, 'GET',{})
//获取订单数据
api.getApproval = params => request.globalRequest(`/applet/order/approval${formatGetUri(params)}`, 'GET',{})

/*
*订单页面
*/

//获取订单数据
api.getOrderList = params => request.globalRequest(`/applet/order/listByUser${formatGetUri(params)}`, 'GET',{})

/*
* 文章栏目接口
*/
//获取文章栏目
api.getArtColumn = params => request.globalRequest(`/applet/column/tree/${params}`, 'GET',{})
//根据栏目id获取栏目
api.getArtItem = params => request.globalRequest(`/applet/column/content/${params}`, 'GET',{})
//根据ID 获取详细信息
api.getArtDetail = params => request.globalRequest(`/applet/column/findContent/${params}`, 'GET',{})

/*
*我的页面
*/
//获取我的的收入状况
api.getUserCount = () => request.globalRequest(`/applet/income/count`, 'GET',{})
//获取我的收入订单
api.getUserOrder = params => request.globalRequest(`/applet/income/order${formatGetUri(params)}`, 'GET',{})
//添加新密码
api.newPassword = params => request.globalRequest(`/app/auto/addPass`, 'POST', params)
//修改密码
api.reSetPassword = params => request.globalRequest(`/applet/income/update`, 'PUT', params)
//完善资料
api.userPerfect = params => request.globalRequest(`/app/auto/perfect`, 'POST', params)
//添加用户名
api.changeName = params => request.globalRequest(`/app/auto/changeName`, 'POST', params)


/**
 * 录入新单接口
 * */
 //获取订单类型
 api.getOrderNav = () => request.globalRequest(`/applet/order/projectList`, 'GET',{})
 //获取订单栏目 法拍房
 api.getOrderNavSub = params => request.globalRequest(`/applet/order/projectList?projectId=${params}`, 'GET',{})
 //获取订单介绍
 api.getOrderIntroduce = params => request.globalRequest(`/applet/order/dynamicFrom/${params}`, 'GET',{})
 //获取推广图下载链接地址
 api.getOrderImgUrl = params => request.globalRequest(`/applet/order/extensionProjectCode/${params}`, 'GET',{})
 // (公积金)银行类型
 api.getBankType = () => request.globalRequest(`/applet/home/findByDictCode/bank_type`, 'GET',{})
 // (公积金)是否有公积金账号
 api.getIsAcc = params => request.globalRequest(`/applet/home/findByDictCode/accumulation_account`, 'GET',{})
 // (公积金)账号状态
 api.getAccountStatus = params => request.globalRequest(`/applet/home/findByDictCode/accumulation_status`, 'GET',{})
 //录入基本信息
 api.newOrderInfo = params => request.globalRequest(`/applet/order/submit`, 'POST', params)
 //根据订单号查询详细
 api.getOrderFileByNumber = params => request.globalRequest(`/applet/order/data/${params}`, 'GET',{})
 //根据id删除照片
 api.detOrderFileByNumber = params => request.globalRequest(`/applet/order/delete/${params}`, 'DELETE',{})
 //根据订单号获取操作记录
 api.getOrderCz = params => request.globalRequest(`/applet/order/findList/${params}`, 'GET',{})
 //更新订单
 api.updateOrder = params => request.globalRequest(`/applet/order/updateFrom`, 'PUT', params)
 
 /**
  * 合伙人界面接口
  **/
  //获取用户数据状态
  api.getParData = params =>  request.globalRequest(`/applet/partner/index?time=${params}`, 'GET',{})
  //获取二维码图片
  api.getParRWM = () =>  request.globalRequest(`/applet/partner/getInviteCode`, 'GET',{})
  //获取合伙人下的经纪人的name
  api.getParName = params =>  request.globalRequest(`/app/auto/empName/${params}`, 'GET',{})
  //删除合伙人
  api.deletePar = params => request.globalRequest(`/applet/partner/deleteAgent/${params}`, 'DELETE',{})
  //获取合伙人信息
  api.getParInfor = params =>  request.globalRequest(`/applet/partner/findAgent/${params}`, 'GET',{})
  //合伙人升级获取升级信息
  api.updatePar = () =>  request.globalRequest(`/applet/partner/applyPartner`, 'GET',{})
  //更新合伙人信息
  api.putParInfo = () => request.globalRequest(`/applet/partner/updateApplyStatus`, 'PUT' )
  
export default api